<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>个人社保计算软件--Web版</title>
		<!-- 新 Bootstrap 核心 CSS 文件 -->
		<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
		 
		<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
		<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
		 
		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<script>
		//这里是写JS代码的位置
		function calc(){
			sal = $("#salary").val();//定位了文本框，并取值
			salnum = parseInt(sal);//将字符串转成数字
			yanglaogr = salnum * 0.08;
			yanglaogs = salnum * 0.2;
			$("#yanglaogr").text(yanglaogr);
			$("#yanglaogs").text(yanglaogs);//将计算好的数字放在相应单元格中
			yiliaogr = salnum * 0.02;
			yiliaogs = salnum * 0.06;
			$("#yiliaogr").text(yiliaogr);
			$("#yiliaogs").text(yiliaogs);
			shiyegr = salnum * 0.005;
			shiyegs = salnum * 0.015;
			$("#shiyegr").text(shiyegr);
			$("#shiyegs").text(shiyegs);
			gongshanggs = salnum * 0.005;
			$("#gongshanggs").text(gongshanggs);
			shengyugs = salnum * 0.008;
			$("#shengyugs").text(shengyugs);
			gongjijingr = salnum * 0.12;
			gongjijings = salnum * 0.12;
			$("#gongjijingr").text(gongjijings);
			$("#gongjijings").text(gongjijings);
			gerenhj = yanglaogr + yiliaogr + shiyegr + gongjijingr;
			$("#gerenhj").text(gerenhj);
			gongsihj = yanglaogs + yiliaogs + shiyegs + gongshanggs + shengyugs + gongjijings
			$("#gongsihj").text(gongsihj);
			$("#zonge").text(salnum + gongsihj);
		}
		</script>
	</head>
	<body>
		<div class="container text-center">
			<h3>个人社保计算软件--崔元捷</h3>
			<table class="table table-bordered text-center">
				<tr>
					<td>工资</td>
					<td colspan="3">
						<input id="salary" class="form-control" type="text" placeholder="请输入工资" />
					</td>
					<td>
						<button onclick="calc()" class="btn btn-danger btn-block">计算</button>
					</td>
				</tr>
				<tr class="bg-primary">
					<td>险种</td>
					<td>个人%</td>
					<td>个人</td>
					<td>公司%</td>
					<td>公司</td>
				</tr>
				<tr>
					<td>养老</td>
					<td>8%</td>
					<td id="yanglaogr"></td>
					<td>20%</td>
					<td id="yanglaogs"></td>
				</tr>
				<tr>
					<td>医疗</td>
					<td>2%</td>
					<td id="yiliaogr"></td>
					<td>6%</td>
					<td id="yiliaogs"></td>
				</tr>
				<tr>
					<td>失业保险</td>
					<td>0.5%</td>
					<td id="shiyegr"></td>
					<td>1.5%</td>
					<td id="shiyegs"></td>
				</tr>
				<tr>
					<td>工伤</td>
					<td></td>
					<td></td>
					<td>0.5%</td>
					<td id="gongshanggs"></td>
				</tr>
				<tr>
					<td>生育</td>
					<td></td>
					<td></td>
					<td>0.8%</td>
					<td id="shengyugs"></td>
				</tr>
				<tr>
					<td>公积金</td>
					<td>12%</td>
					<td id="gongjijingr"></td>
					<td>12%</td>
					<td id="gongjijings"></td>
				</tr>
				<tr>
					<td>合计</td>
					<td>个人合计</td>
					<td id="gerenhj"></td>
					<td>公司合计</td>
					<td id="gongsihj"></td>
				</tr>
				<tr>
					<td>总额</td>
					<td colspan="4">
						<output id="zonge"/>  
					</td>
				</tr>
			</table>
		</div>
	</body>
</html>
